package com.cpj.bsyyzx.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cpj.bsyyzx.entity.ExitRegistration;
import com.cpj.bsyyzx.entity.GoToRegister;
import com.cpj.bsyyzx.mapper.ExitRegistrationMapper;
import com.cpj.bsyyzx.service.IExitRegistrationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 五个臭皮匠
 * @since 2021-04-27
 */
@Service
public class ExitRegistrationServiceImpl extends ServiceImpl<ExitRegistrationMapper, ExitRegistration> implements IExitRegistrationService {

    @Override
    public Page pageList(Page page, ExitRegistration exitRegistration) {
        if(page == null){
            page = new Page();
        }

        QueryWrapper<ExitRegistration> wrapper = new QueryWrapper<>();

        if(StringUtils.isNotBlank(exitRegistration.getUserName())) {
            wrapper.like("user_name",exitRegistration.getUserName());
        }

        // 如果分页返回 IPage 如果不分页 返回 List
        return super.page(page,wrapper);
    }

    @Override
    public IPage<ExitRegistration> selectPageVo(Page<ExitRegistration> page, Wrapper<ExitRegistration> wrapper) {
        return getBaseMapper().selectPageVo(page,wrapper);
    }
}
